﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ZD_MVC.Models
{

    public class Author
    {
        public Author()
        {
        }

        public Guid Id { get; set; }
        [Required]
        public string Name { get; set; }
        [Required]
        public int Age { get; set; }
        public virtual ICollection<Blog> Blogs { get; set; }
    }


    public class Blog
    {
        public Guid Id { get; set; }
        [Required(ErrorMessage = "姓名不能为空")]
        public string Name { get; set; }
        public virtual ICollection<Article> Articles { get; set; }
        public virtual Author Author { get; set; }
    } 

    public class Article
    {
        public Guid Id { get; set; }
        [Required]
        public string Title { get; set; }
        public string Content { get; set; }
        public virtual Author Author { get; set; }
        public virtual Blog Blog { get; set; }
    }


}